package com.zhiyu.service;

import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.zhiyu.common.BaseService;
import com.zhiyu.mapper.ProductsMapper;
import com.zhiyu.pojo.FlowerWood;
import com.zhiyu.pojo.Products;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class ProductsService extends BaseService<ProductsMapper, Products> {

    public PageInfo<Products> getProByFlowerWood(Products products) {
        PageHelper.startPage(products.getPageNum(), products.getPageSize());
        List<Products> list = mapper.selectProductsByFlowerWood(products.getWoodId());
        return new PageInfo<>(list);
    }

    public PageInfo<Products> getProductByName(Products products) {
        PageHelper.startPage(products.getPageNum(), products.getPageSize());
        List<Products> list = mapper.selectProductByName(products.getProName());
        return new PageInfo<>(list);
    }
}